<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<script src="/js/jquery.min.js"></script>
	<link rel="stylesheet" type="text/css" href="/css/bootstrap.css" />
	<script src="/js/bootstrap.js"></script>
	<link rel="stylesheet" type="text/css" href="/css/admincss.css" />
	<link rel="stylesheet" href="/layui/css/layui.css" />
	<script src="/layui/layui.js"></script>
	<title>@yield('title')</title>
	<style type="text/css">
		html,body{
			font-family: "微软雅黑";
			height: 100%;
		}
	</style>
</head>
<body>
	
	<div class="pages">
		<!-- header part -->
		@section('header')
		<div class="header">
			<div class="headerLeft">鹤庭净水后台数据管理平台</div>
			<div class="headerRight">
				<p class="hintTxt"></p> 
				<div>
					<span>欢迎您：</span>
	                <span class="AccountName">{{ $user->username }}</span>
				</div>
				<div class="btn modifyPassword">
					<p class="modifyLogo"></p>
					<p >修改密码</p>
				</div>
				<div class="btn bowOut">
					<p class="bowoutLogo"></p>
					<p style="margin-left: 25px;">退出</p>
				</div>
			</div>
		</div>
		@show
		<!-- content part -->
		<div class="content">
			<!-- contentLeft part -->
			<div class="contentLeft">
				<div class="logoBox"><img src="/img/admin/logoPic.png" /></div>
				<ul class="menuList">
					<a class="devicelist" href="/admin/device/index">
						<img src="/img/admin/deviceListLogo.png" />设备列表
					</a>
					<a class="reminders" href="/admin/device/reminder/filter">滤芯寿命提醒<span class="filterHintNum">{{ $filter_reminders_count or 0 }}</span>
					</a>
					<a class="remindersFlux" href="/admin/device/reminder/flow">剩余流量提醒<span class="fluxHintNum">{{ $flow_reminders_count or 0 }}</span>
					</a>
					<a class="remindersTds" href="/admin/device/reminder/tds">净水TDS提醒<span class="tdsHintNum">{{ $tds_reminders_count or 0 }}</span>
					</a>
					<a class="remindersState" href="/admin/device/reminder/status">水机状态提醒<span class="stateHintNum">{{ $status_reminders_count or 0 }}</span>
					</a>
					<a class="customers" href="/admin/user/customers">
						<img src="/img/admin/userInfoLogo.png" />用户信息
					</a>
					<a class="afterservices" href="/admin/user/afterServices">售后服务<span class="notServiceNum">{{ $after_services_count or 0 }}</span>
					</a>
					<a class="installinfos" href="/admin/device/installInfos">安装信息</a>
					<a class="maintaininfos" href="/admin/device/maintainInfos">维护信息<span class="notMaintaininfosNum">{{ $maintain_info_count or 0 }}</span></a>
					<a class="chargerecords" href="/admin/device/chargeRecords">
						<img src="/img/admin/shopCarLogo.png" />充值管理
					</a>
					<a class="dealerManage" href="/admin/device/chargeRecords/dealer">经销商管理</a>
					<a class="index" href="/admin/user/index">
						<img src="/img/admin/accountManageLogo.png" />账号管理
					</a>
					<a class="deviceHitch" href="/admin/device/faults">设备故障记录</a>
					<a class="moreSetTextButton">
						<img style="display: none;" class="imgMore" src="/img/admin/moreSet1.png" />
						<img src="/img/admin/moreSet.png" />更多设置</a>
					<ul class="moreSet">
						@if($user->hasAnyAccess('admin'))
						<a class="index bindInfor" href="/admin/more/message/bind">绑定消息设置</a>
						@endif
						@if($user->hasAnyAccess('superadmin'))
						<a class="index priceConversion" href="/admin/more/price">购买流量价格设置</a>
						@endif
					</ul>
				</ul>
			</div>
			<!-- contentRight part -->
			<div class="contentRight">
				<div class="itemText">
					<span class="spanFirst">当前位置：</span>
	               	@section('firstItem')
					    
					@show
				</div>
				<div class="searchList">
					@section('searchList')

	                @show
				</div>
				<div class="clearfloat"></div> 
				<!-- table part -->
				@section('dataTables')
				
	            @show
	            <!-- page number part -->
	            <div class="rightFooter">
	        	@section('add_div')
			
	       		@show
				@section('page_num')
				
				@show
				</div>
	            @section('infor_promit')
			</div>
			<div class="clearfloat"></div> 
		</div>
		@show
		<!-- 修改密码弹框 -->
		<div class="accountManage" id="updatePasswordBox">
			<div><span>旧密码</span><input class="oddPassword" type="password" placeholder="请输入旧密码" /><label class="required">*</label></div>
			<div><span>新密码</span><input class="newPassword" type="password" placeholder="请输入新密码" /><label class="required">*</label></div>
			<div><span>确认密码</span><input class="confirmPassword" type="password" placeholder="请再输入新密码" /><label class="required">*</label></div>
			<div>
				<label class="labelBox" id="updataPWlabelBox"></label>
			</div>
			<div class="btnBox" >
				<a class="updataPWNoBtn">取消</a>
				<a class="okBtn updataPWOkBtn">确定</a>
			</div>
		</div>
		<!-- 删除维护信息弹框 -->
		<div class="deleteBox" style="display: none;">
			<p>删除</p>
			<div class="titleText">确定删除此条维护信息？</div>
			<div class="btnBox">
				<a class="cancelBtn">取消</a>
				<a class="okBtn">确定</a>
			</div>
		</div>
		<!-- 退出账号弹框 -->
		<div class="bowOutBox deleteAccount">
			<div class="titleText">确定退出此账号？</div>
			<label class="labelBox" id="bowOutLabelBox"></label>
			<div class="btnBox">
				<a class="bowOutNoBtn">取消</a>
				<a class="okBtn bowOutOkBtn">确定</a>
			</div>
		</div>
		<!-- 提示信息框 -->
		<div class="hint_box">
			<p class="hint_text"></p>
			<div class="hint_btn">确定</div>
		</div>
	</div>
	<script>
	function hint(hint){
		if(hint)
		{
			layui.use('layer', function(){
			  	var layer = layui.layer;
			  	layer.open({
					type: 1, 
					title: ['信息提示', 'font-size:18px;'],
					area: ['500px', '300px'],
				  	content: $(".hint_box")
				}); 
			});
			$('.hint_text').html(hint);
			$('.hint_btn').click(function(){
				window.location.reload();
			});
		}

	}	
	//下拉框函数
	function DropBoxFn(eventOb,dropBoxOb){
		$(eventOb).unbind('click').click(function(event){
			event.stopPropagation();
			$(dropBoxOb).show();
			$(dropBoxOb).children("a").unbind('click').click(function(){
				$(eventOb).val($(this).html());
				$(dropBoxOb).hide();
			})
			$("body").unbind('click').click(function(){
				$(dropBoxOb).hide();
			});
		})
	}
	function DropinputFn(eventObj,dropBoxObj,fluxNumBoxObj){
		$(eventObj).unbind('click').click(function(event){
			event.stopPropagation();
			$(dropBoxObj).show();
			$(dropBoxObj).children("a").unbind('click').click(function(){
				$(eventObj).val($(this).html());
				$(fluxNumBoxObj).html(Math.round($(eventObj).val()/$(".fluxPrice").val()));
				$(dropBoxObj).hide();
				$(".labelBox").html("");
			})
			$("body").unbind('click').click(function(){
				$(dropBoxObj).hide();
			});
		})
	}
	//左边导航栏下拉框
	$(".moreSetTextButton").click(function(){
		$(".moreSet").slideToggle();
		$(".imgMore").toggle().siblings().toggle();
	});
	//计算左边导航栏高度
	if($(".contentRight").height()<$("body").height()-140){
		$(".contentLeft").height($("body").height()-140);
	}else{
		$(".contentLeft").height($(".contentRight").height());
	}
	//修改密码
	$(".modifyPassword").click(function(){
		$(".oddPassword").val("");
		$(".newPassword").val("");
		$(".confirmPassword").val("");
		$(".labelBox").html("");
		layui.use('layer', function(){
		  	var layer = layui.layer;
		  	layer.open({
				type: 1, 
				title: ['修改密码', 'font-size:18px;'],
				area: ['600px', '360px'],
			  	content: $("#updatePasswordBox")
			}); 
		}); 
		//取消按钮
		$('.updataPWNoBtn').unbind('click').click(function(){
			window.location.reload();
		});
		//确定按钮
		$(".updataPWOkBtn").unbind('click').click(function(){
			$.ajax({
				url:"/admin/api/user/updatePassword",
				type:"post",
				dataType:"json",
				data:{
					password:$(".oddPassword").val(),
					new_password:$(".newPassword").val(),
					new_password_confirmation:$(".confirmPassword").val()
				},
				success:function(data){
					if(data.status.errCode==0){
						$("#updataPWlabelBox").html("修改密码成功");						
					}else{
						$("#updataPWlabelBox").html(data.status.message);
					}
				}
			})
		})
	});
	//退出登录
	$(".bowOut").click(function(){
		$(".labelBox").html("");
		layui.use('layer', function(){
		  	var layer = layui.layer;
		  	layer.open({
				type: 1, 
				title: ['退出账号', 'font-size:18px;'],
				area: ['500px', '300px'],
			  	content: $(".deleteAccount")
			}); 
		});
		//取消按钮
		$('.bowOutNoBtn').unbind('click').click(function(){
			window.location.reload();
		});
		//确定按钮
		$(".bowOutOkBtn").unbind('click').click(function(){
			$.ajax({
				url:"/admin/api/user/logout",
				type:"post",
				dataType:"json",
				success:function(data){
					if (data.status.errCode==0) {
						window.location.href = "/admin/user/login";
					}else{
						$("#bowOutLabelBox").html(data.status.message);
					}
				}
			})
		})
	});
	//查找浏览器是否为ie6，ie7，ie8
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=b_version.split(";");
	var trim_Version=version[1].replace(/[ ]/g,"");

	if(browser=="Microsoft Internet Explorer")
	{	
	    if(trim_Version=="MSIE5.0")
	    {
	    	$(".hintTxt").show().html("当前浏览器版本为IE5，请更新到IE8或IE8以上的浏览器打开当前网页，或用360浏览器极速模式打开，否则可能会影响部分页面的正常渲染");
	    	setTimeout(function(){
	    		$(".hintTxt").hide();
	    	},10000)
	    }else if(trim_Version=="MSIE5.5"){
	    	$(".hintTxt").show().html("当前浏览器版本为IE5.5，请更新到IE8或IE8以上的浏览器打开当前网页，或用360浏览器极速模式打开，否则可能会影响部分页面的正常渲染");
	    	setTimeout(function(){
	    		$(".hintTxt").hide();
	    	},10000)
	    }else if(trim_Version=="MSIE6.0"){
	    	$(".hintTxt").show().html("当前浏览器版本为IE6，请更新到IE8或IE8以上的浏览器打开当前网页，或用360浏览器极速模式打开，否则可能会影响部分页面的正常渲染");
	    	setTimeout(function(){
	    		$(".hintTxt").hide();
	    	},10000)
	    }else if(trim_Version=="MSIE7.0"){
	    	$(".hintTxt").show().html("当前浏览器版本为IE7，请更新到IE8或IE8以上的浏览器打开当前网页，或用360浏览器极速模式打开，否则可能会影响部分页面的正常渲染");
	    	setTimeout(function(){
	    		$(".hintTxt").hide();
	    	},10000)
	    }
	}
</script>
</body>
</html>
